#include <fstream>
#include <string>
#include <opencv2/opencv.hpp>

void cv_to_csv(std::string fname, cv::Mat m)
{
    std::ofstream f;
    f.open(fname.c_str());
    f << cv::format(m, cv::Formatter::FMT_CSV) << std::endl;
    f.close();
}